package com.luckynote.common.base.config;


import com.luckynote.common.base.Filter.GatherLogWebFilter;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 *  Servlet过滤器配置类
 * @author: Leopold
 * @date: 2019/7/8 10:15
 */
@Configuration
public class ServletFilter {

    /**
     * 创建FilterRegistrationBean
     * @return
     */
    @Bean
    public FilterRegistrationBean gatherLogWebFilter() {
        FilterRegistrationBean registrationBean
                = new FilterRegistrationBean<>();

        registrationBean.setFilter(new GatherLogWebFilter());
        registrationBean.addUrlPatterns("/*");

        return registrationBean;
    }
}
